import React from 'react';
import Bread from '../../component/TableContent/VipBread';
import { Breadcrumb, Input, Select,Radio,Button,message  } from 'antd';
import axios from '../../utils/http';
const { Option } = Select;

//添加社区合伙人
class AddPartner extends React.Component {
  constructor() {
    super()
    this.state = {
      selectreturn: {
        cmtptsName:'',//姓名
        cmtptsPhone:'',//手机
        cmtptsCmtname:'',//小区名称
        cmtptsCmtsca:'',//小区规模
        cmtptsCmtars:'',//小区地址
        cmtptsBcan:'',//银行卡账号
        cmtptsNoob:'',//开户行姓名
        cmtptsCoob:'',//开户行名称
        cmtptsIdcard:'',//身份证号码
        cmtptsRd:'',//是否充值押金
      }
    }
  }
  inputchange = who => {
    return e=> {
      let selectreturn = this.state.selectreturn
      selectreturn[who] = e.target.value
      this.setState({
        selectreturn
      })
    }
  }
  optionchange = value => {
    let selectreturn = this.state.selectreturn
      selectreturn.cmtptsCmtsca=value
      this.setState({
        selectreturn
      })
  }
  shequ = () => {
    this.props.history.push('/Home/huiYuan/Partner')
  }
  addparter = () => {
    this.props.history.push('/Home/huiYuan/AddPartner')
  }
  jiesuan = () => {
    this.props.history.push('/Home/huiYuan/SetManage')
  }
  onChange = e => {
    let selectreturn = this.state.selectreturn
      selectreturn.cmtptsRd=e.target.value
      this.setState({
        selectreturn
      })
  };
  makesure = () => {
    axios({
      url: '/member/addCmtpts',
      method: 'post',
      data: this.state.selectreturn
    }).then(data => {
      if(data.data.code === 200){
        message.success('添加成功')
      }
    })
  }
render(){
return (
  <div>
    <Bread mianbao='社区合伙人'></Bread>
    <Breadcrumb>
      <Breadcrumb.Item onClick={this.shequ}>社区合伙人管理</Breadcrumb.Item>
      <Breadcrumb.Item onClick={this.addparter}>添加社区合伙人</Breadcrumb.Item>
      <Breadcrumb.Item onClick={this.jiesuan}>结算管理</Breadcrumb.Item>
    </Breadcrumb>
    <div className='wrapper'>
      姓名 <Input placeholder='姓名' style={{width:200}} onChange={this.inputchange('cmtptsName')}></Input> <br/> <hr/> 
      手机 <Input placeholder='手机' style={{width:200}}  onChange={this.inputchange('cmtptsPhone')}></Input> <br/> <hr/> 
      小区名称 <Input placeholder='小区名称' style={{width:200}} onChange={this.inputchange('cmtptsCmtname')}></Input> <br/> <hr/> 
      小区规模 <Select defaultValue="中" style={{ width: 120 }} onChange={this.optionchange}>
                <Option value="big">大</Option>
                <Option value="middle">中</Option>
                <Option value="small">小</Option>
              </Select> <br/> <hr/> 
      小区地址 <Input  placeholder='小区地址' style={{width:200}} onChange={this.inputchange('cmtptsCmtars')}></Input> <br/> <hr/> 
      银行卡账号 <Input placeholder='银行卡账号' style={{width:200}} onChange={this.inputchange('cmtptsBcan')}></Input> <br/> <hr/> 
      开户行姓名 <Input placeholder='开户行姓名' style={{width:200}} onChange={this.inputchange('cmtptsNoob')}></Input> <br/> <hr/> 
      开户行名称 <Input placeholder='开户行名称' style={{width:200}} onChange={this.inputchange('cmtptsCoob')}></Input> <br/> <hr/> 
      身份证号码 <Input placeholder='身份证号码' style={{width:200}} onChange={this.inputchange('cmtptsIdcard')}></Input> <br /> <hr /> 
      是否充值押金  <Radio.Group onChange={this.onChange}>
      <Radio value={1}>已充值</Radio>
      <Radio value={0}>未充值</Radio>
    </Radio.Group><hr/>
        <Button className='surename' onClick={this.makesure}>确定</Button>
    </div>
  </div>
);
}
}
export default AddPartner;